#!/usr/bin/env bash
# using a function located in the middle of a script

# 如果在函数被定义钱使用函数，你会收到一条错误消息

count=1
echo "This line comes before the function definition"

function func1 {
	echo "This is an example of a function"
}

count=1
while [ $count -le 5 ]; do
	func1
	count=$((count + 1))
done

echo "This is the end of the loop"
func2
echo "Now this is the end of the script"

function func2 {
	echo "This is an example of a function"
}
